package gamefw.tests;

import gamefw.framework.Coordinate;
import gamefw.framework.Move;
import gamefw.gameplugin.PlayResult;
import gamefw.gameplugin.PlayResult.ResultType;
import junit.framework.TestCase;

public class TestPlayResult extends TestCase {

	/**
	 * PR01
	 * Test the creation of a TestPlayResult for the DO_NOTHING action.
	 */
	public void testDoNothing() {
		PlayResult pr = new PlayResult();
		assertTrue(pr.getResultType().equals(ResultType.DO_NOTHING));
	}

	/**
	 * PR02
	 * Test the creation of a TestPlayResult for the SELECT action.
	 * Check if the correct position is returned.
	 */
	public void testSelect() {
		PlayResult pr = new PlayResult(new Coordinate(0,0));
		assertTrue(pr.getResultType().equals(ResultType.SELECT));
		assertEquals(pr.getPosition().getX(), 0);
		assertEquals(pr.getPosition().getY(), 0);
	}
	
	/**
	 * PR03
	 * Test the creation of a TestPlayResult for the MOVE action.
	 * Checks if the correct origin and destination positions are returned.
	 */
	public void testMove() {
		Coordinate from = new Coordinate(0,0);
		Coordinate to = new Coordinate(1,1);
		PlayResult pr = new PlayResult(new Move(from, to));

		assertTrue(pr.getResultType().equals(ResultType.MOVE));
		assertEquals(pr.getMove().getFrom().getX(), 0);
		assertEquals(pr.getMove().getFrom().getY(), 0);
		assertEquals(pr.getMove().getTo().getX(), 1);
		assertEquals(pr.getMove().getTo().getY(), 1);		
	}

}
